package com.vehicle.exception;

import com.vehicle.vo.ResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//异常统一处理机制
@RestControllerAdvice//相当于AOP
@Slf4j
public class UnifiedExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    public ResultVO handlerException(Exception e){
        log.info("服务器内部异常，{}",e.getMessage());
        return ResultVO.fail(e.getMessage());
    }
}
